//package com.atguigu.search.controller;
//
//import org.elasticsearch.action.index.IndexRequest;
//import org.elasticsearch.client.RestClientBuilder;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.elasticsearch.xcontent.XContentType;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.HashMap;
//import java.util.Map;
//
//@RestController
//public class HelloController {
//
//    @Resource
//    RestHighLevelClient client;
//    @Resource
//    RestClientBuilder builder;
//
//    @GetMapping("/hello")
//    public Object hello(){
//        Map map = new HashMap();
//        map.put("client",client);
//        map.put("builder",builder);
//        return "SUCCESS";
//    }
//
//    public void save() {
//        IndexRequest request = new IndexRequest("posts");
//        request.id("1");
//        String jsonString = "{" +
//                "\"user\":\"kimchy\"," +
//                "\"postDate\":\"2013-01-30\"," +
//                "\"message\":\"trying out Elasticsearch\"" +
//                "}";
//        request.source(jsonString, XContentType.JSON);
//    }
//}
